<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Admin_User extends Controller {
    
    public function action_saveInfo(){

        $id=$this->request->post('model__id');

        $username=$this->request->post('username');

        $email=$this->request->post('email');

        $sex=$this->request->post('sex');

        $age=$this->request->post('age');

        $remark=$this->request->post('remark');

        $model=new Model_Admin_SysUser();

        echo $model->saveInfo($id,$username,$email,$sex,$age,$remark);
    }
    public function action_deleteInfo(){

        $id=$this->request->post('id');

        $model=new Model_Admin_Common();

        echo $model->deleteInfo("sysuser",$id);
    }
    public function action_loadInfoById(){

        $id=$this->request->post('id');

        $sql="select t.sysuserid model_id,t.fullname username,t.email,t.sex,t.age,t.remark
              from sysuser t
              where t.sysuserid='$id'
              limit 1";

        $model=new Model_Admin_Common();

        echo $model->loadInfoById($sql);
    }
    public function action_login(){

        $email=$this->request->post('user_email');

        $pwd=$this->request->post('user_pwd');

        $model=new Model_Admin_SysUser();
        
        echo $model->login($email,$pwd);
    }

    public function action_alertpwd(){

        $old_pwd=$this->request->post('old_pwd');

        $new_pwd=$this->request->post('new_pwd');

        $model=new Model_Admin_SysUser();

        echo $model->alertPwd($old_pwd,$new_pwd);

    }
}
?>